//    Copyright (C) Kherty.  All rights reserved.
using System;

namespace OpenLS.Spreadsheet
{
    using CellUnaryFunction = Action<Cell>;
    using CellBinaryFunction = TernaryAction<Cell, Cell, PasteInfo>;
    using RangeBinaryFunction = TernaryAction<Range, Range, PasteInfo>;
    using DimensionBinaryFunction = BinaryAction<Dimension, Dimension>;
    using System.Diagnostics.Contracts;
    internal delegate void BinaryAction<T, U>(T obj, U obj2);
    internal delegate void TernaryAction<T, U, V>(T obj, U obj2, V obj3);

    class RangeFunction
    {
        private readonly TableFunction _tableFunction;
        public TableFunction TableFunction
        {
            get { return _tableFunction; }
        }

        public RangeFunction(CellUnaryFunction clearFunction,
            Action<Dimension> clearDimension,
            CellBinaryFunction copyFunction, 
            DimensionBinaryFunction copyDimensionFunction,
            DimensionBinaryFunction copyRowColumnFunction,
            TableFunction tableFunction,
            RangeBinaryFunction rangeCopyFunction)
        {
            Contract.Requires(rangeCopyFunction != null);
            _tableFunction= tableFunction;
            _clearFunction = clearFunction;
            _clearDimension = clearDimension;
            _copyFunction = copyFunction;
            _copyDimensionFunction = copyDimensionFunction;
            _copyRowColumnFunction = copyRowColumnFunction;
            _rangeCopyFunction = rangeCopyFunction;

        }

        readonly RangeBinaryFunction _rangeCopyFunction;

        private RangeBinaryFunction RangeCopyFunction
        {
            get {
                Contract.Ensures(Contract.Result<RangeBinaryFunction>() != null);
                return _rangeCopyFunction;
            }
        }
        private readonly DimensionBinaryFunction _copyDimensionFunction;
        public DimensionBinaryFunction CopyDimensionFunction
        {
            get { return _copyDimensionFunction; }
        }
        private readonly DimensionBinaryFunction _copyRowColumnFunction;
        public DimensionBinaryFunction CopyRowcolumnFunction
        {
            get { return _copyRowColumnFunction; }
        }
	
        private readonly CellBinaryFunction _copyFunction;

        public CellBinaryFunction CopyFunction
        {
            get { return _copyFunction; }
        }
        public void CopyRange(Range source, Range destination, PasteInfo pasteInfo)
        {
            this.RangeCopyFunction(source, destination, pasteInfo);
        }
        private readonly CellUnaryFunction _clearFunction;

        public CellUnaryFunction ClearCell
        {
            get { return _clearFunction; }
        }

        private readonly Action<Dimension> _clearDimension;
        public Action<Dimension> ClearDimension
        {
            get { return _clearDimension; }
        }
	
	
	
    }
}
